home *** CD-ROM | disk | FTP | other *** search
- /* Functions for getting information about a volume.
-
- 93/10/16 aih
- - added VolNameType
-
- 93/03/10 AIH
- - Added check for support for FSSpec calls to check for FSpExchangeFiles
-
- 91/07/03 AIH
- - Added function to return free space on a volume
-
- 91/06/01 AIH
- - Added function to test whether a volume supports the desktop manager
-
- 91/05/27 Ari Halberstadt (AIH)
- - Created this file */
-
- #include <string.h>
- #include "MacLib.h"
- #include "VolumeLib.h"
-
- /* get a volume parameter block */
- void VolumeParameters(VolType vol, GetVolParmsInfoBuffer *params)
- {
- HParamBlockRec pb;
-
- memclr(&pb, sizeof(HParamBlockRec));
- pb.ioParam.ioVRefNum = vol;
- pb.ioParam.ioBuffer = (Ptr) params;
- pb.ioParam.ioReqCount = sizeof(GetVolParmsInfoBuffer);
- FailOSErr(PBHGetVolParms(&pb, false));
- }
-
- /* true if the volume supports file IDs, as described in IM-VI */
- Boolean VolumeSupportsFileIDs(VolType vol)
- {
- GetVolParmsInfoBuffer params;
-
- VolumeParameters(vol, ¶ms);
- return((params.vMAttrib & bHasFileIDs) != 0);
- }
-
- /* true if the volume supports the FSpExchangeFiles routine */
- Boolean VolumeSupportsFSpExchangeFiles(VolType vol)
- {
- return(MacHasFSSpec() && VolumeSupportsFileIDs(vol));
- }
-
- /* true if the volume has a desktop database */
- Boolean VolumeSupportsDesktopMgr(VolType vol)
- {
- GetVolParmsInfoBuffer params;
-
- VolumeParameters(vol, ¶ms);
- return((params.vMAttrib & bHasDesktopMgr) != 0);
- }
-
- /* return free space */
- size_t VolumeFree(VolType vol)
- {
- HParamBlockRec pb;
-
- memclr(&pb, sizeof(HParamBlockRec));
- pb.volumeParam.ioVRefNum = vol;
- FailOSErr(PBHGetVInfo(&pb, false));
- return(pb.volumeParam.ioVFrBlk * pb.volumeParam.ioVAlBlkSiz);
- }
-